package bulletbehavior 
{
	/**
	 * ...
	 * @author morgan
	 */
	public class SetAngleBehavior extends BulletBehavior
	{
		public var angle:Number
		public function SetAngleBehavior(angle:Number) 
		{
			this.angle = angle
		}
		
		override public function onActivate(b:Bullet):void 
		{
			super.onActivate(b);
			
			var speed:Number = Math.sqrt(b.velocity.x * b.velocity.x + b.velocity.y * b.velocity.y);
			var newAngle:Number = angle * 3.14159 / 180;
			b.velocity.x = Math.cos(newAngle) * speed;
			b.velocity.y = Math.sin(newAngle) * speed;			
		}
		
	}

}